package com.provafinal.dao;

import com.provafinal.entity.Acesso;
import java.util.List;
import javax.persistence.Query;

public class AcessoDAO extends DAO {

    public List<Acesso> listarAcesso() {
        System.out.println("_-_-_- ListarAcessoDAO");
        Query q = criaQuery("SELECT a FROM Acesso a ORDER BY a.nome");
        return q.getResultList();
    }

    public List<Acesso> acessarSistema(String login, String senha) {
        Query q = criaQuery("SELECT a FROM Acesso a WHERE a.login ='" + login + "' AND senha='" +senha+ "'");
        return q.getResultList();
    }
}
